package t1_2

import (
	"src/db"
	"src/db/db_modle"
	"src/handler/tools"
	"src/modle"
	"sync"
)

// 近30天内通讯录电话通话次数
func CheckCallRecordLengthIn30Days(ch *chan modle.DetailsType, sy *sync.WaitGroup, uid uint, rrb db_modle.RiskRuleBase) {
	logId := tools.GetLogId(uid, rrb.Oid)
	count, e := db.GetNumOfCallRecordIn30Days(uid, tools.Days30, logId)
	if e != nil {
		// 指标查询异常未获取到该用户信息
		tools.FillDetails(rrb.Oid, uint(count), tools.ExecuteFailed, 0, e.Error(), ch, sy)
		return
	}
	tools.SmallAndEqualLimit(uint(count), ch, sy, rrb, rrb.Score)
}
